<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>任务-我的任务</title>
    <meta name="description" content="Ela Admin - HTML5 Admin Template">
    <meta name="viewport" content="width=device-width, initial-scale=1">



    <link rel="stylesheet" href="/resa/css/normalize.css">
    <link rel="stylesheet" href="/resa/css/bootstrap.min.css">
    <link rel="stylesheet" href="/resa/css/font-awesome.min.css">
    <link rel="stylesheet" href="/resa/css/themify-icons.css">
    <link rel="stylesheet" href="/resa/css/pe-icon-7-filled.css">
    <link rel="stylesheet" href="/resa/css/flag-icon.min.css">
    <link rel="stylesheet" href="/resa/css/style.css">

    <link rel="stylesheet" href="/resa/css/mytask.css">
    <link rel="stylesheet" href="/resa/css/fileinput.css" media="all" type="text/css"/>
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"  crossorigin="anonymous">
    <link rel="stylesheet" href="/resa/themes/explorer-fas/theme.css" media="all" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
    <link rel="stylesheet" href="/resa/css/datepicker.css">

    <link rel="stylesheet" href="/resa/css/contextMenu.css" />

    <link href="/resa/vendors/pnotify/dist/pnotify.css" rel="stylesheet">
    <link href="/resa/vendors/pnotify/dist/pnotify.buttons.css" rel="stylesheet">
    <link href="/resa/vendors/pnotify/dist/pnotify.nonblock.css" rel="stylesheet">

    <style>

        li:hover{
            transition: all 0.5s;
            margin-left: 10px;
        }


        .ttype{
            padding: 5px 19px;
            border-radius: 8px;
            border: none;
            outline: none;
             /*将默认的select选择框样式清除*/
             appearance:none;
            -moz-appearance:none;
            -webkit-appearance:none;
            -ms-appearance:none;
            /*!*在选择框的最右侧中间显示小箭头图片*!*/
            /* background: url(resa/img/add.png) no-repeat scroll right center ;*/

        }
        .ttype:hover{
            border: solid 1px;
            border-color: #1FD6BB;


        }

        /*.navbar .navbar-nav li.menu-item-has-children a:before {
                    content: "";
                    position: absolute;
                    top: 23px;
                    right: -90px;
                    width: 8px;
                    height: 8px;
                    border-style: solid;
                    border-width: 1px;
                    border-color: #607d8b #607d8b transparent transparent;
                    -webkit-transform: rotate(45deg);
                            transform: rotate(45deg);
                    -webkit-transition: all .25s ease;
                    transition: all .25s ease; }*/
        #modl{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 35px;
            z-index: 1000;
            left: 0px;
            background: white;
            text-align: center;

        }
    </style>
</head>
<body>
<div id="modl">
    <img src="/resa/images/ww_loading.gif">
</div>
<!-- Left Block -->
<div class="row" style="width:100%;height: 100%;">

    <!-- /# column -->
    <div class="col-sm-12" style="padding-right: 0px;   padding-left: 0px;">
        <div class="card" style="border-radius: 0px;">
            <!--<div class="card-header active">-->
                <!--<div class="stat-icon dib flat-color-4">-->
                    <!--<i class="menu-icon fa fa-user"></i>-->
                <!--</div>-->


                <!--&nbsp;<a>我负责的</a>-->
            <!--</div>-->
            <div class="card-body" style="padding: 0px;">
                <div class="custom-tab">

                    <nav>
                        <div class="nav nav-tabs" id="nav-tab" role="tablist">
                            <a class="nav-item nav-link active" id="custom-nav-home-tab" data-toggle="tab" href="#custom-nav-home" role="tab" style="color: #6A7074;font-size: 14px;" aria-controls="custom-nav-home" aria-selected="true">活动任务</a>
                            <a class="nav-item nav-link" id="custom-nav-profile-tab" data-toggle="tab" href="#custom-nav-profile" role="tab" style="color: #6A7074;font-size: 14px;" aria-controls="custom-nav-profile" >完成任务</a>

                        </div>
                    </nav>
                    <div class="tab-content pl-3 pt-2" id="nav-tabContent" style="background-color: #F0F0F0;">
                        <div class="tab-pane fade show active" id="custom-nav-home" role="tabpanel" aria-labelledby="custom-nav-home-tab">
                            <div class="row" id="taskcard">
                                <div class="col-sm-4 ">
                                    <div class="card ">
                                        <div class="card-body" >

														                                <span style="color: #6A7074">收件箱
														                				</span>&nbsp;
                                            <div class="stat-icon dib flat-color-10">
                                                <i class="count" id="onesucc"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-2">
                                                <i class="count" id="oneing"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-4">
                                                <i class="count" id="oneerr"></i>
                                            </div>

                                            <div class="progress mb-2" style="height: 5px;">
                                                <div class="progress-bar bg-flat-color-10" id="onesuccPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                                <div class="progress-bar bg-flat-color-2" id="oneingPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                            </div>

                                            <div id="one" class="div" >
                                                <div class="addtask card-body" style="display: none;">
                                                    <form class="card-content">
                                                        <textarea name="textarea-input" id="textarea-input"  placeholder="..." class="form-control focused"></textarea>
                                                        <div style="margin-top: 10px;"></div>
                                                        <div class="row">
                                                            <div class="col-md-12">
                                                                <button type="button"  class="btn btn-success btn-sm" >确定</button>
                                                                <button type="reset"  class="btn btn-secondary btn-sm cancel">取消</button>
                                                                <select  name="confirm_email" data-validate-linked="email" required="required" class="ttype ">
                                                                    <option value="1" selected="selected">研发需求</option>
                                                                    <option value="2">研发任务</option>
                                                                    <option value="3">缺陷</option>
                                                                </select>
                                                            </div>
                                                            <!--<div class="col-md-6">
                                                                <div class="c-datepicker-date-editor c-datepicker-single-editor J-datepickerTime-single mt10">
                                                                      <i class="c-datepicker-range__icon kxiconfont icon-clock"></i>
                                                                      <input type="text" style="width: 60px;" autocomplete="off" name="" placeholder="选择日期" class=" c-datepicker-data-input" value="">
                                                                    </div>
                                                            </div>-->
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>

                                            <div class="col-sm-12" style="color: #6A7074;cursor: pointer;">
                                                <div class="row">
                                                    <div class="card-body">

                                                        <div class="black-hover">
                                                            <i class="menu-icon  ti-plus newTask" title="one">&nbsp;添加新任务</i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>


                                    </div>
                                </div>

                                <div class="col-sm-4 ">
                                    <div class="card">
                                        <div class="card-body" >
                                            <!--<div class="stat-widget-two">
                                                <div class="stat-icon dib flat-color-2">
                                                    <i class="ti-arrow-circle-right"></i>&nbsp;
                                                </div>
                                               <span>今天要做</span>
                                            </div>-->
                                            <span style="color: #6A7074">当前要做</span>&nbsp;
                                            <div class="stat-icon dib flat-color-10" >
                                                <i class="count" id="twosucc"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-2" >
                                                <i class="count" id="twoing"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-4">
                                                <i class="count"  id="twoerr"></i>
                                            </div>
                                            <div class="progress mb-2" style="height: 5px;">
                                                <div class="progress-bar bg-flat-color-10" id="twosuccPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                                <div class="progress-bar bg-flat-color-2" id="twoingPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                            </div>

                                            <div id="two" class="div">
                                                <div class="addtask" style="display: none;">
                                                    <form class="card-content">
                                                        <textarea name="textarea-input" id="textarea-input"  placeholder="..." class="form-control focused"></textarea>
                                                        <div style="margin-top: 10px;"></div>
                                                        <div class="row">
                                                            <div class="col-md-12">
                                                                <button type="button"  class="btn btn-success btn-sm" >确定</button>
                                                                <button type="reset"  class="btn btn-secondary btn-sm cancel">取消</button>
                                                                <select  name="confirm_email" data-validate-linked="email" required="required" class="ttype ">
                                                                    <option value="1" selected="selected">研发需求</option>
                                                                    <option value="2">研发任务</option>
                                                                    <option value="3">缺陷</option>
                                                                </select>
                                                            </div>
                                                            <!--<div class="col-md-6">
                                                                <div class="c-datepicker-date-editor c-datepicker-single-editor J-datepickerTime-single mt10">
                                                                      <i class="c-datepicker-range__icon kxiconfont icon-clock"></i>
                                                                      <input type="text" style="width: 60px;" autocomplete="off" name="" placeholder="选择日期" class=" c-datepicker-data-input" value="">
                                                                    </div>
                                                            </div>-->
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>

                                            <div class="col-sm-12" style="color: #6A7074;cursor: pointer;">
                                                <div class="row">
                                                    <div class="card-body">

                                                        <div class="black-hover">
                                                            <i class="menu-icon  ti-plus newTask" title="two">&nbsp;添加新任务</i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-sm-4 ">
                                    <div class="card">
                                        <div class="card-body" >
                                            <!--<div class="stat-widget-two">
                                                <div class="stat-icon dib flat-color-3">
                                                    <i class="ti-arrow-circle-right"></i>&nbsp;
                                                </div>
                                                <span>下一步要做</span>
                                            </div>-->

                                            <span style="color: #6A7074">下一步要做</span>&nbsp;
                                            <div class="stat-icon dib flat-color-10">
                                                <i class="count" id="threesucc"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-2">
                                                <i class="count" id="threeing"></i>
                                            </div>
                                            <span>/</span>
                                            <div class="stat-icon dib flat-color-4">
                                                <i class="count" id="threeerr"></i>
                                            </div>

                                            <div class="progress mb-2" style="height: 5px;">
                                                <div class="progress-bar bg-flat-color-10" id="threesuccPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                                <div class="progress-bar bg-flat-color-2" id="threeingPro" role="progressbar" style="width: 0%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                                            </div>
                                            <div id="three" class="div">
                                                <div class="addtask" style="display: none;">
                                                    <form class="card-content">
                                                        <textarea name="textarea-input" id="textarea-input"  placeholder="..." class="form-control focused"></textarea>
                                                        <div style="margin-top: 10px;"></div>
                                                        <div class="row">
                                                            <div class="col-md-12">
                                                                <button type="button"  class="btn btn-success btn-sm" >确定</button>
                                                                <button type="reset"   class="btn btn-secondary btn-sm cancel">取消</button>
                                                                <select  name="confirm_email" data-validate-linked="email" required="required" class="ttype ">
                                                                    <option value="1" selected="selected">研发需求</option>
                                                                    <option value="2">研发任务</option>
                                                                    <option value="3">缺陷</option>
                                                                </select>
                                                            </div>
                                                            <!--<div class="col-md-6">
                                                                <div class="c-datepicker-date-editor c-datepicker-single-editor J-datepickerTime-single mt10">
                                                                      <i class="c-datepicker-range__icon kxiconfont icon-clock"></i>
                                                                      <input type="text" style="width: 60px;" autocomplete="off" name="" placeholder="选择日期" class=" c-datepicker-data-input" value="">
                                                                    </div>
                                                            </div>-->
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>

                                            <div class="col-sm-12" style="color: #6A7074;cursor: pointer;">
                                                <div class="row">
                                                    <div class="card-body">
                                                        <div class="black-hover">
                                                            <i class="menu-icon  ti-plus newTask" title="three">&nbsp;添加新任务</i>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                    </div>
                                </div>



                            </div>
                        </div>
                        <div class="tab-pane fade" id="custom-nav-profile" role="tabpanel" aria-labelledby="custom-nav-profile-tab">
                            <!-- /#header -->
                            <div class="embed-responsive embed-responsive-16by9" style="height: 500px;">
                                <iframe id="table-data" name="iframeName" class="embed-responsive-item" src="/resa/task/task_table.do" ></iframe>
                            </div>

                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>



    <!--<button type="button" class="btn btn-primary">活动任务</button>
    <button type="button" class="btn btn-success">完成任务</button>-->
</div>










<script src="/resa/js/lib/data-table/datatables.min.js"></script>
<script src="/resa/js/lib/data-table/dataTables.bootstrap.min.js"></script>
<!-- Scripts -->
<!--<script src="/resa/assets/js/vendor/jquery.min.js"></script>-->
<!--<script src="/resa/assets/js/vendor/jquery-2.1.4.min.js"></script>-->
<script src="/resa/js/popper.min.js"></script>

<script src="/resa/js/jquery.matchHeight.min.js"></script>
<script src="/resa/js/main.js"></script>
<script src="/resa/js/lib/chosen/chosen.jquery.min.js"></script>

<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="/resa/js/jquery.contextMenu.min.js"></script>

<!--<script src="/resa/js/mouseRight.min.js" type="text/javascript" charset="utf-8"></script>-->

<!--<script src="/resa/js/data.js"></script>-->
<script src="/resa/js/plugins/moment.min.js"></script>
<script src="/resa/js/datepicker.all.js"></script>

<script src="/resa/js/plugins/sortable.js" type="text/javascript"></script>
<script src="/resa/js/fileinput.js" type="text/javascript"></script>
<script src="/resa/js/locales/fr.js" type="text/javascript"></script>
<script src="/resa/js/locales/es.js" type="text/javascript"></script>
<script src="/resa/themes/fas/theme.js" type="text/javascript"></script>
<script src="/resa/themes/explorer-fas/theme.js" type="text/javascript"></script>

<script src="/resa/js/ckeditor.js"></script>
<script src="/resa/js/sample.js"></script>
<script src="/resa/js/bootstrap.min.js"></script>

<!-- PNotify -->
<script src="/resa/vendors/pnotify/dist/pnotify.js"></script>
<script src="/resa/vendors/pnotify/dist/pnotify.buttons.js"></script>
<script src="/resa/vendors/pnotify/dist/pnotify.nonblock.js"></script>
<script>

    var i=5;
    $(document).ready(function($) {
//	  	alert('jQuery版本：' + $.fn.jquery);


        //关闭点击之后下拉菜单关闭
        $("body").on('click','[data-stopPropagation]',function (e) {
            e.stopPropagation();
        });





        //点击确定按钮
        $(".btn-success").each(function(i,m){
            $(m).click(function(){
                var text=($(this).parent().parent().parent().parent());
                console.log($($(this).parent().parent().parent().parent().parent()).attr("id"));
                var id=$($(this).parent().parent().parent().parent().parent()).attr("id");
                var forms=$($(this).parent().parent().parent().parent()).find("form")[0];
                console.log(forms)
                var data={"descr":$(forms).find("#textarea-input").val(),
                            "select":$(forms).find("select").val(),
                            "id":id}
                $.ajax({
                    url:'/resa/task/insertMyTask.do',
                    data:data,
                    dataType:'json',
                    type:'post',
                    success:function(result){
                        console.log(result)
                        if(result.code==200){
                            var data=result.data.taskinfo;
                            console.log(data.filePath)
                            console.log("新增任务成功")
                            var icon=(data.icon).substring((data.icon).indexOf("<i"),(data.icon).indexOf("i>")+2)
                            init($,"#"+id,icon,data);


                            $(text).hide(500)
                            $(".newTask").each(function(i,j){
                                var nowid=$(j).attr("title");
                                if($(text).attr("id")!=nowid){
                                    $(j).show(500)
                                }

                            });
                            var e=document.getElementById(id);
                            e.scrollTop=0;
                        }
                    },error:function(result){
                        alert("请求失败")
                    }
                })
            })
        })

        //点击取消按钮
        $('.cancel').each(function(i,m){
            $(m).click(function(){
                $($(this).parent().parent().parent().parent()).hide(500)
                var id=$($(this).parent().parent().parent().parent()).attr("id");
                $(".newTask").each(function(i,j){
                    var nowid=$(j).attr("title");
                    if(id!=nowid){
                        $(j).show(500)
                    }

                });
            })
        })

        //点击活动
        $("#custom-nav-home-tab").click(function(){
            window.location.href="/resa/task/mytask.do"
        })
        //点击完成任务
        $("#custom-nav-profile-tab").click(function(){
           iframeName.window.location.reload(true);
        })
        // setInterval(function(){

        // },30)



        $("[data-toggle='popover']").popover();

        //初始化数据
        inits();

        //初始化时间插件
        data();

        //鼠标右击事件
        // right();

        //判断是否添加滚动条
        addOver()

        //显示状态模态框
        // showModal();
        //修改任务状态
        // updateTaskStatus();

        //添加新任务事件
        addTask();

    });

    //初始化数据
    function inits(){

        $.ajax({
            url:'/resa/task/myTask.do',
            type:'POST',
            dataType:'JSON',
            success:function(result){
                console.log(result)
                for (var prop in result) {
                    var muo = result[prop];
                    for (var key in muo) {
                        $(muo[key]).each(function (i, m) {
                            var icon = (m.icon).substring((m.icon).indexOf("<i"), (m.icon).indexOf("i>") + 2)

                            init($, "#" + key, icon, m);
                            propress(key)
                        })

                    }
                }

                $('#modl').hide();

            }

        })

        // init($,"#one");
        // init($,"#one");
        // init($,"#one");
        // init($,"#one");
        //
        // init($,"#two");
        // init($,"#two");
        // init($,"#two");
        //
        // init($,"#three");
        // init($,"#three");
        // init($,"#three");
        // init($,"#three");

    }

    function propress(key){

        setInterval(function(){
            var oneText= $($("#"+key).find(".card-block"))
            var err=0;
            var ing=0;
            var succ=0;
            $(oneText).each(function(i,n){
                var content=$($(n).find(".taskStatus")[0]).children("span").text();
                if(content=="未开始"){
                    err++;
                }else if(content=="进行中"){
                    ing++;
                }else{
                    succ++;
                }
            });
            var count=err+ing+succ;
            if(count==0){
                count=1;
            }
            var succPro=((succ/count).toFixed(2))*100 +"%";
            var errPro=((err/count).toFixed(2))*100 +"%";
            var ingPro=((ing/count).toFixed(2))*100 +"%";


            // console.log(succPro)
            // console.log(errPro)
            // console.log(ingPro)
            $("#"+key+"err").text(err);
            $("#"+key+"ing").text(ing);
            $("#"+key+"succ").text(succ);
            $("#"+key+"succPro").width(succPro);
            $("#"+key+"ingPro").width(ingPro);

        },30)

    }
    function showParent(){

        //显示父级模态框
        var taskInfo=$(".taskInfo");
        taskInfo.each(function(i,m){
            $(m).click(function(){
                 console.log($(this).attr("title"))
                 var id=$(this).attr("title");
                //显示teskinfo 框
                $(window.top)[0].show(id);
            })
        });
    }

    function addTask(){
        //添加新任务
        $(".newTask").each(function(i,m){
            $(m).click(function(){
                //获得id
                var id=$(this).attr("title");
                $(this).hide(500);
                console.log("this=="+id)
                $(".newTask").each(function(i,j){
                    var nowid=$(j).attr("title");
                    if(id!=nowid){
                        $(j).show(500)
                    }

                });

                //显示输入框
                var is=["one","two","three"]
                for(var i=0;i<is.length;i++){
                    if(id!=is[i]){
                        $("#"+is[i]).children(".addtask").hide(500);

                    }
                }
                $("#"+id).children(".addtask").show();
                var e=document.getElementById(id);
                e.scrollTop=e.scrollHeight;

            })
        })

    }
    //显示状态模态框
    function showModal(){

        $(".taskStatus").each(function(i,m){
            $(m).click(function(){
                //获得对应的模态框id
                var myModal_id=$(this).children(".modeladdress").attr("id");
                $("#"+myModal_id).find("li").each(function(ii,mm){
                    $(mm).find(".col-sm-4").find("i").removeClass("fa-check");
                    $(mm).find(".col-sm-4").find("i").addClass("fa-gear")

                    if($(mm).find("span").text()==$(m).find(".statusName").text()){
                        $(mm).find(".col-sm-4").find("i").removeClass("fa-gear")
                        $(mm).find(".col-sm-4").find("i").addClass("fa-check");
                    }
                })
                $("#"+myModal_id).modal("show");


            })
        })
    }

    function updateTaskStatus(){
        // var tid="";
        $('.modeladdress').each(function(i,mm){

            // $(mm).click(function(){
            //     console.log($(this).attr("title"))
            //     tid=$(this).attr("title");
            // });
            var li=mm.children[0].children[0].children[0].children[0].children;

            for(var j=0;j<li.length;j++){
                li[j].onclick=function(){
                    var tid=$($(this).parent().parent().parent().parent().parent()).attr("title");
                    var statusId=$(this).attr("title");
                    console.log("状态："+statusId)
                    var ele=($(this).closest(".card-block"))
                    var modelid=($(this).closest(".modeladdress").attr("id"))
                    var div=($(this).closest(".div").attr("id"));
                    console.log(modelid)
                    $.ajax({
                        url:'/resa/task/updataTaskStatus.do',
                        data:{"tid":tid,"sid":statusId},
                        dataType:"JSON",
                        type:"POST",
                        success:function(result){
                            if(result.code==200){
                                var data=result.data;
                                console.log(data.filePath)
                                console.log("更新任务状态成功")
                                var icon=(data.icon).substring((data.icon).indexOf("<i"),(data.icon).indexOf("i>")+2)
                                $(ele).remove();
                                init($,"#"+div,icon,data);

                                updateTaskStatus();

                                $(".modal-backdrop").each(function(i,m){
                                    $(m).remove()
                                })
                                showModal();
                                //显示父弹框
                                showParent();
                                right();
                                // window.location.reload(true);
                            }
                        }
                    })
                    // console.log(this.innerText)
                }
            }


        })
    }

    //判断是否加滚动条
    function addOver(){
        //判断是否添加滚动条
        var div=$(".div");
        div.each(function(i,m){
//			console.log($(m).height())
            var t;
            if($(m).height()>=410 ||$(m).children().length>3){
                $(m).addClass("card-over")
                // clearInterval(t)
            }else{
                m.Class="div"
                // t=setInterval(function(){
                //     $(m).height((($(m).children().length-1)*125+50)+"px");
                // },30)
            }

        })


    }


    function right(){
        var c="";
        var tid="";
        $("#one section").contextMenu({
            width: 110, // width
            itemHeight: 30, // 菜单项height
            bgColor: "#333", // 背景颜色
            color: "#fff", // 字体颜色
            fontSize: 12, // 字体大小
            hoverBgColor: "#99CC66", // hover背景颜色
            target: function(ele) { // 当前元素
                console.log($($(ele).children().children()[1]).attr("title"));
                tid=$($(ele).children().children()[1]).attr("title");
                c=$(ele).parent().parent().parent();
            },
            menu: [{
                text: "当前要做",
                icon: "/resa/img/add.png",
                callback: function() {
                    updateTaskLeibie(tid,2,"#two",c);

                }
            },
                {
                    text: "下一步要做",
                    icon: "/resa/img/add.png",
                    callback: function() {
                        updateTaskLeibie(tid,3,"#three",c);
                    }
                }
            ]
        });
        $("#two section").contextMenu({
            width: 110, // width
            itemHeight: 30, // 菜单项height
            bgColor: "#333", // 背景颜色
            color: "#fff", // 字体颜色
            fontSize: 12, // 字体大小
            hoverBgColor: "#99CC66", // hover背景颜色
            target: function(ele) { // 当前元素
                console.log($($(ele).children().children()[1]).attr("title"));
                tid=$($(ele).children().children()[1]).attr("title");
                c=$(ele).parent().parent().parent()
            },
            menu: [{
                text: "收件箱",
                icon: "/resa/img/add.png",
                callback: function() {
                    updateTaskLeibie(tid,1,"#one",c);
                }
            },
                {
                    text: "下一步要做",
                    icon: "/resa/img/add.png",
                    callback: function() {
                        updateTaskLeibie(tid,3,"#three",c);
                    }
                }
            ]
        });

        $("#three section").contextMenu({
            width: 110, // width
            itemHeight: 30, // 菜单项height
            bgColor: "#333", // 背景颜色
            color: "#fff", // 字体颜色
            fontSize: 12, // 字体大小
            hoverBgColor: "#99CC66", // hover背景颜色
            target: function(ele) { // 当前元素
                console.log($($(ele).children().children()[1]).attr("title"));
                tid=$($(ele).children().children()[1]).attr("title");
                c=$(ele).parent().parent().parent();
            },
            menu: [{
                text: "收件箱",
                icon: "/resa/img/add.png",
                callback: function() {
                    updateTaskLeibie(tid,1,"#one",c);
                }
            },
                {
                    text: "当前要做",
                    icon: "/resa/img/add.png",
                    callback: function() {
                        updateTaskLeibie(tid,2,"#two",c);
                    }
                }
            ]
        });
    }
    //修改任务类别
    function updateTaskLeibie(tid,lei,id,c){

        $.ajax({
            url:'/resa/task/updateTaskLeibie/'+tid+'/'+lei+'.do',
            dataType:'json',
            type:'post',
            success:function(result){
                if(result.code==200){
                    console.log("修改任务类别成功")
                    $(id).prepend("<div class='card-block'>"+c.html()+"</div>");
                    $(c).remove()
                    c="";
                    right();
                    //判断是否添加滚动条
                    addOver()
                    showModal();
                    showParent();
                    updateTaskStatus();
                }
            }
        })
    }

    //时间插件
    function data(){
        var DATAPICKERAPI = {
            // 快捷选项option
            rangeShortcutOption1: [{
                name: '最近一周',
                day: '-7,0'
            }, {
                name: '最近一个月',
                day: '-30,0'
            }, {
                name: '最近三个月',
                day: '-90, 0'
            }],
        };

        //年月日范围
        $('.J-datepicker-range-day').datePicker({
//          hasShortcut: true,
            format: 'YYYY-MM-DD',
            isRange: true,
            shortcutOptions: DATAPICKERAPI.rangeShortcutOption1
        });



    }



    function init($,id,icon,m){

        // alert("新增："+id+"/"+icon+"/"+m.ptName+"/"+m.taskStatusId+"/")
        i++;
        var contents=' <div class="card-block">'+
            '			                                	 <div class="row" id="tasksmall">'+
            '									                    <div class="col col-lg-12" style="margin-top: 5px" >'+
            '									                        <section class="card" style="cursor: pointer;border-radius: 0px;">'+
            '									                            <div class="card-body">'+
            '									                            		<div class="row">'+
            '											                            	<div class="col-sm-8">'+
            '											                            		<div  class="stat-icon dib bg-flat-color-'+m.taskStatusId+' taskStatus"  style="padding:0 10px" >'+
            '						                                      							<div class="stat-icon dib flat-color-'+m.taskStatusId+'">'+icon+'</div>'+
            '					                                									<span class="statusName">'+m.ptName+'</span>'+
            '					                                								'+
            '				                                								<div class="modeladdress modal fade" id="myModal'+i+'" title="'+m.tId+'" tabindex="-1" role="dialog" >'+
            '																					    <div class="modal-dialog " role="document">'+
            '																						        <div class="modal-content">'+
            '																						            <div class="modal-body">'+
            '																						            '+
            '																							            <ul class="nav navbar-nav">'+
            '																							            	<li class="li"title="1">'+
            '																							            		<div class="row">'+
            '																								            		<div class="col-sm-8" style="padding-left: 0px">'+
            '																									            		<div class="stat-icon dib flat-color-1">'+
            '														                                      								<i class="menu-icon ti-power-off"></i>'+
            '														                                								</div><span >未开始</span>'+
            '																										            </div>'+
            '																										            <div class="col-sm-4">'+
            '																										            	<i class="menu-icon fa fa-check "></i>'+
            '																										            </div>'+
            '																									            </div>'+
            '																				            				</li>'+
            '																						            	<li class="li" title="2">'+
            '																						            		<div class="row">'+
            '																							            		<div class="col-sm-8" style="padding-left: 0px">'+
            '																								            		<div class="stat-icon dib flat-color-2">'+
            '													                                      								<i class="menu-icon ti-pie-chart"></i>'+
            '													                                								</div><span >进行中</span>'+
            '																									            </div>'+
            '																									            <div class="col-sm-4">'+
            '																									            	<i class="menu-icon fa fa-gear"></i>'+
            '																									            </div>'+
            '																								            </div>'+
            '																						            	</li>'+
            '																						            	<li class="li" title="3">'+
            '																						            		<div class="row">'+
            '																							            		<div class="col-sm-8" style="padding-left: 0px">'+
            '																								            		<div class="stat-icon dib flat-color-3">'+
            '													                                      								<i class="menu-icon  fa fa-check-circle"></i>'+
            '													                                								</div><span >已完成</span>'+
            '																									            </div>'+
            '																									            <div class="col-sm-4">'+
            '																									            	<i class="menu-icon  fa fa-gear "></i>'+
            '																									            </div>'+
            '																								            </div>'+
            '																						            	</li>'+
            '																						            </ul>'+
            '																					            '+
            '								                                      							</div>'+
            '																					        </div>'+
            '																					    </div>'+
            '																				</div>'+
            '				                                								'+
            '				                                      						</div>'+
            '				                                      					</div>'+
            '			                                      					</div>'+
            '			                                      					<div class="row taskInfo" title="'+m.tId+'"><div class="col-sm-8" style="padding-top: 10px;" title="右击修改类别">'+m.title+'</div>'+
            '					                                      					<div class="col-sm-4">'+
            '					                                      						<img style="border-radius: 50px;" class="navbar-brand" src="'+m.url+m.filePath+'" alt="Logo">'+
            '					                                      					</div>'+
            '			                                      					</div>'+
            '								                            	'+
            '								                            	<div class="text-secondary">'+
            '								                            		<div class="col-sm-12">'+
            '								                            			<div class="stat-icon dib bg-flat-color-5">任务编号:'+m.tNumber+'</div>' +m.endStart+'</div>'+
            '								                            	</div>'+
            '								                            	'+
            '								                            </div>'+
            '								                        </section>'+
            '								                    </div>'+
            '								                </div>'+
            '		                                </div>'
        $(id).prepend(contents)


        //鼠标右击事件
        right();

        //判断是否添加滚动条
        addOver()

        //显示状态模态框
        showModal();
        //修改任务状态
        updateTaskStatus();
        //显示父弹框
        showParent();

    }
    //data-toggle="modal" data-target="#task"
</script>
</body>
</html>
